/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.agi.util.showdata;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

/**
 *
 * @author Renato
 */
public class PintorPadrao implements Pintor {
    protected int px,py;
    protected int down;
    protected Graphics g;


    @Override
    public void iniciarPintura(BufferedImage buf, double firstPoint) {
        down=buf.getHeight()-1;        
        px=0;
        py=(int) firstPoint;
        g=buf.getGraphics();
        g.setColor(Color.white);
        g.fillRect(0,0, buf.getWidth(), buf.getHeight());
        g.setColor(Color.black);
        
    }

    @Override
    public void printData(int x, double y) {
        g.drawLine(px, down - py, x, down - (int)y);
        px=x;
        py=(int)y;
    }
}
